package NewCoder;

public class BM31 {
    boolean isSymmetrical(TreeNode pRoot) {
        if(pRoot==null) return true;
        return isSymme(pRoot.left,pRoot.right);
    }
    private boolean isSymme(TreeNode left,TreeNode right){
        if(left==null && right==null) return true;
        if(left==null || right==null) return false;
        if(left.val!=right.val) return false;
        return isSymme(left.left,right.right) && isSymme(left.right,right.left);

    }
}
